package PerlBot::Plugin::Help;
use strict;
use warnings;
use base 'Class::Component::Plugin';

sub help :Hook('help') {
    my ($self, $c, $args) = @_;

    my $command = $args->{desc};
    unless ($command) {
	$args->{irc}->yield( privmsg => $args->{where} => $_ ) foreach @{ $self->config->{messages} };
	return 0;
    }
    
    if ($self->config->{$command}) {
	$args->{irc}->yield( privmsg => $args->{where} => $_ ) foreach @{ $self->config->{$command} };
    }
}

1;
